package com.haoshuang.zhouzhoubang.ui.page.study.train

import android.os.Bundle
import androidx.fragment.app.Fragment
import com.haoshuang.zhouzhoubang.databinding.FragmentTrainExamVpBinding
import com.haoshuang.zhouzhoubang.ui.adapter.ViewPagerAdapter
import com.haoshuang.zhouzhoubang.ui.page.study.StudyFragment
import com.haoshuang.zhouzhoubang.ui.page.study.train.child.TrainExamArticleFragment
import com.mufeng.libs.base.BaseVMFragment

/**
 *  
 */
class TrainExamVpFragment : BaseVMFragment<TrainExamVpViewModel, FragmentTrainExamVpBinding>() {

    companion object {
        fun getInstance(): TrainExamVpFragment {
            val fragment = TrainExamVpFragment()
            fragment.arguments = Bundle().apply {

            }
            return fragment
        }
    }

    private val mFragments = ArrayList<Fragment>()  //存放学习子界面的Fragment集合
    private val mTitles = arrayListOf("培训")   //存放标题文字内容集合

    override fun initView(savedInstanceState: Bundle?) {
        mFragments.add(TrainExamArticleFragment.getInstance())
        val mAdapter = ViewPagerAdapter(childFragmentManager, lifecycle, mFragments)
        binding.viewPager.adapter = mAdapter

        binding.slidingTabLayout.isTabSpaceEqual = false

        binding.slidingTabLayout.setViewPager2( binding.viewPager, mTitles)
        // 此处将其放置顶层即可，若是放到下面将会导致重复
        binding.viewPager.isUserInputEnabled = false
        binding.viewPager.offscreenPageLimit = 1
    }

    override fun initData() {

    }

    override fun lazyLoadData() {

    }

    override fun startObserve() {

    }

}